package gamer2;

import irio.gamer.RenderingSettingsFrame;
import irio.gamer.gamer;

import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JTabbedPane;

import lamer.ImageFrame;
import lamer.InputFrame;
import lamer.LSettings;
import lamer.LikelihoodFrame;
import utils.IniFile;
import Logic.Galaxy;
import Logic.GamerParams;
import Logic.RenderingParameters;

public class gamer2 {

	static JFrame mainFrame = null;
	public static GamerParams gamerParams = null;
	public static Galaxy galaxy = null;

	static JTabbedPane jtbMain = null, jtbRendering = null;
	static OGLCanvas oglCanvas;
	static InputFrame inputFrame = new InputFrame();
	static LikelihoodFrame likelihoodFrame = new LikelihoodFrame();
	public static RenderingParameters rp = null;
	private RenderingSettingsFrame renderingSettingsFrame = null;
	
	
	
	public gamer2() {
		mainFrame = new JFrame();
		oglCanvas = new OGLCanvas();
		gamerParams = new GamerParams();
		gamer.galaxy = new Galaxy();
		galaxy = gamer.galaxy;
		gamerParams.Load();

		jtbRendering = new JTabbedPane();
		gamer.rp = new RenderingParameters("renderparameters.ini");
		rp = gamer.rp;
		
		renderingSettingsFrame = new RenderingSettingsFrame();

		
		mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		mainFrame.setTitle("Gamer version " + gamerParams.version);
		mainFrame.setSize((int) gamerParams.screenSize.x,
				(int) gamerParams.screenSize.y);


		IniFile.SaveTextfile("result.txt", "");
		
		// This will center the JFrame in the middle of the screen
		mainFrame.setLocationRelativeTo(null);

		
		mainFrame.setLayout(new GridLayout(1, 2));
		mainFrame.add(oglCanvas);
		
		jtbMain = new JTabbedPane();
		//jtbInput = new JTabbedPane();
		//jtbLikelihood = new JTabbedPane();
		
		//jtbMain.addTab("Input", null, jtbInput, "Input");
		//jtbMain.addTab("Likelihood", null, jtbLikelihood, "Input");
		jtbMain.addTab("Rendering", null, jtbRendering, "Rendering");
		jtbRendering.addTab("Render settings", null, renderingSettingsFrame,
				"Render settings");

		mainFrame.add(jtbMain);
		
		mainFrame.setVisible(true);
		
	}
	
}
